package com.hmyuan.webdesktop.service;

import java.util.List;

import javax.annotation.Resource;

import org.springframework.stereotype.Service;

import com.github.pagehelper.PageHelper;
import com.hmyuan.webdesktop.domain.UserFilesource;
import com.hmyuan.webdesktop.mapper.UserFilesourceMapper;
/**
 * 文件资源配置service
 * @author suxiaofei
 *
 */
@Service
public class UserFilesourceService {

	@Resource
	UserFilesourceMapper userFilesourceMapper;
	/**
	 * 根据id查询文件资源配置
	 * @param id
	 * @return
	 */
	public UserFilesource findById(int id){
		
		return userFilesourceMapper.selectByPrimaryKey(id);
	}
	
	public List<UserFilesource> findListByPage(UserFilesource fs,int pageNum,int pageSize){
		PageHelper.startPage(pageNum, pageSize);
		return userFilesourceMapper.selectList(fs);
	}

	public List<UserFilesource> findList(UserFilesource userFilesource) {
		// TODO Auto-generated method stub
		return userFilesourceMapper.selectList(userFilesource);
	}

	public boolean update(UserFilesource userFilesource) {
		// TODO Auto-generated method stub
		int num = userFilesourceMapper.updateByPrimaryKeySelective(userFilesource);
		return num==1?true:false;
	}

	public boolean save(UserFilesource userFilesource) {
		// TODO Auto-generated method stub
		int num = userFilesourceMapper.insert(userFilesource);
		return num==1?true:false;
	}

	public boolean deleteById(Integer id) {
		// TODO Auto-generated method stub
		int num = userFilesourceMapper.deleteByPrimaryKey(id);
		return num==1?true:false;
	}

	
}
